// fitsconverter.h
#ifndef FITSCONVERTER_H
#define FITSCONVERTER_H

#include <vector>
#include <string>
#include <utility>
#include <cstdint>
#include "fitsio.h"

class FitsConverter {
public:
    static bool processBinToFits(const std::string& binPath,
                                 const std::string& outputDir,
                                 const std::string& baseFilename,
                                 const std::vector<std::pair<std::string, std::string>>& keywords);

private:
    static std::vector<uint16_t> readBinaryFile(const std::string& filename);
    static std::vector<std::vector<uint16_t>> splitDataIntoColumns(const std::vector<uint16_t>& data, int numColumns);
    static std::vector<std::vector<uint16_t>> reshapeColumns(const std::vector<std::vector<uint16_t>>& columns, int rows, int cols);
    static std::vector<uint16_t> concatenateColumns(const std::vector<std::vector<uint16_t>>& columns);
    static bool writeFitsFile(const std::string& filePath,
                              const std::vector<uint16_t>& imageData,
                              int width, int height,
                              const std::vector<std::pair<std::string, std::string>>& keywords);
};

#endif // FITSCONVERTER_H
